home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sea_weapons.cog < prev    next >
Text File  |  1999-11-15  |  10KB  |  394 lines

  1. # Jones 3D Cog Script
  2. #
  3. # Sea_Weapons.cog
  4. #
  5. # [DS & revised by HB]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ==============================================================================
  10.  
  11. symbols
  12.  
  13.     message        startup
  14.     message        activated
  15.     message        entered
  16.     message        exited
  17.     message        pulse
  18.     message        blocked
  19.     message        touched
  20.     message        user0
  21.  
  22.     keyframe    in_activate=in_activate_medium.key    local
  23.  
  24.     sound        guardsnd1=inxh1003.wav                local # Give up Jones!
  25.     sound        guardsnd2=se01q07.wav                local # What? (when not found)
  26.     sound        nocommie=inxj134.wav                local # Where did that commie rat scurry..
  27.     sound        getknife=inxj227.wav                local # A machete (0.9 sec)
  28.     sound        getwhip=se02j01.wav                    local # My whip!..... (3.8 sec)
  29.     sound        getgun=se02j02.wav                    local # My trusted smith & wesson (2.8 sec)
  30.     sound        bop_indy=sea_bop_indy.wav            local
  31.  
  32.     thing        machete
  33.     thing        revolver
  34.     thing        whip
  35.     thing        enemypos
  36.     thing        oildrum    
  37.     thing        hide_crate
  38.     thing        cam1spot                    nolink
  39.     thing        cam1lookspot                nolink                                
  40.     thing        player                        local
  41.     thing        commie                        local # create on the fly
  42.     thing        caughtindy                    local # ditto
  43.     thing        weapindy                    local # ditto
  44.  
  45.     cog            alarmcog                    # 10_SEA_Alarm.cog
  46.     cog            weaponcontrol                # sea_WeaponControl.cog
  47.     cog            hintcog                        # sea_hints.cog
  48.  
  49.     template    indy_tpl=indy_actor            local
  50.     template    sailor_tpl=sailor_tokarev    local
  51.  
  52.     int            machetebin=7                local
  53.     int            revolverbin=3                local
  54.     int            whipbin=2                    local
  55.     int            gotten=0                    local
  56.     int            touched=0                    local
  57.     int            cursound                    local
  58.     int            tutched                    local
  59.  
  60. #---------Put indy back in cell------------------
  61.  
  62.     keyframe    acthit=01h_sailor_pistolwhip.key        local
  63.     keyframe    in_raiseHands=0in_stand1_bd_3.key        local
  64.     keyframe    in_fall=in_die_buckle.key                local
  65.  
  66.     cog            brigcog                                    # sea_BrigDoor.cog
  67.     cog            pumpcog                                    # sea_leverpump.cog
  68.  
  69.     surface        commiespot
  70.     surface        commiespot2
  71.  
  72.     int            in_keytrack1                            local
  73.     int            caught=0                                local
  74.     int            in_colltype                                local
  75.     int            curhealth                                local
  76.  
  77. #--------- Kill Indy ----------------------------
  78.  
  79.     sound        guardsnd3=se01q05.wav                    local # Enough!
  80.     sound        killsnd=gen_pistol_fire.wav                local
  81.  
  82.     int            notagain=0                                local
  83.     int            victim                                    local
  84.  
  85.  
  86. # ---------Camera Fade Stuff---------------------
  87.  
  88.     thing        fadeghost
  89.     thing        fadething
  90.  
  91. # --------- SubRoutines ---------------------
  92. flex        fade_out                            local
  93.  
  94. end
  95.  
  96. # ==============================================================================
  97.  
  98. code
  99.  
  100. # ..............................................................................
  101.  
  102. startup:
  103.  
  104.     player = GetLocalPlayerThing();
  105.     commie = CreateThing(sailor_tpl, enemypos);
  106.     CaptureThing(commie);
  107.     SetThingMass(commie, 0);
  108.     SetActorFlags(commie, 0x8); # Invul.
  109.     AISetCutsceneMode(commie);
  110.     SetThingAlpha(commie, 1.0);
  111.     SetThingAlpha(fadething, 0.0); # transparent
  112.     return;
  113.  
  114. # ..............................................................................
  115.  
  116. activated:
  117.     
  118.     if (GetSenderRef() == oildrum && gotten == 0)
  119.     {
  120.         SendMessageEx(hintcog, user1, 1, 0, 0, 0); # param0=1; weapons picked up
  121.         MakeMeStop();
  122.         DeselectWeaponWait(player);
  123.         StartCutscene(0);
  124.  
  125.         SetExtCamOffset('0.15 -0.06 0.065'); # interp cam out to player's right
  126.  
  127.         # prep
  128.         weapindy = CreateThing(indy_tpl, player);
  129.         CaptureThing(weapindy);
  130.         ClearThingFlags(weapindy, 0x80000);
  131.         SetCollideType(weapindy, 0);
  132.         CopyPlayerHolsters(player, weapindy);
  133.         SetThingFlags(player, 0x80000);
  134.         AISetLookThing(weapindy, machete);
  135.         AIWaitForStop(weapindy);
  136.  
  137.         #---------- add revolver ----------------------
  138.         ChangeInv(player, revolverbin, 1.0);
  139.         SetInvAvailable(player, revolverbin, 1);
  140.         PlayVoice(player, getgun, 1.0, 0);
  141.         Sleep(2.6);
  142.         PlayKey(weapindy, in_activate, 4, 0x12, 0);
  143.         Sleep(0.2);
  144.         DestroyThing(revolver);
  145.         JonesInvItemChanged(revolverbin);
  146.         Sleep(2.0);
  147.  
  148.         #---------- add whip --------------------------
  149.         ChangeInv(player, whipbin, 1.0);
  150.         SetInvAvailable(player, whipbin, 1);
  151.         PlayVoice(player, getwhip, 1.0, 0);
  152.         Sleep(3.6);
  153.         PlayKey(weapindy, in_activate, 4, 0x12, 0);
  154.         Sleep(0.2);
  155.         DestroyThing(whip);
  156.         JonesInvItemChanged(whipbin);
  157.         Sleep(2.0);
  158.  
  159.         #---------- add machete -----------------------
  160.         ChangeInv(player, machetebin, 1.0);
  161.         SetInvAvailable(player, machetebin, 1);
  162.         PlayVoice(player, getknife, 1.0, 10);
  163.         Sleep(0.7);
  164.         PlayKey(weapindy, in_activate, 4, 0x12, 0);
  165.         Sleep(0.2);
  166.         DestroyThing(machete);
  167.         JonesInvItemChanged(machetebin);
  168.         Sleep(2.0);
  169.  
  170.         SendMessage(weaponcontrol, 27); # tell cog that took weapons Indy's got 'em back
  171.         DestroyThing(commie); # won't see him no more
  172.         TeleportThing(player, weapindy);
  173.         DestroyThing(weapindy);
  174.         ClearThingFlags(player, 0x80000);
  175.         
  176.         RestoreExtCam();
  177.         EndCutscene();
  178.         ClearActorFlags(player, 0x200000);
  179.         gotten = 1;
  180.  
  181.         # Tell alarmcog player has weapons...
  182.         SendMessage(alarmcog, user4);
  183.     }
  184.  
  185.     return;
  186.  
  187. # ..............................................................................
  188.  
  189. entered:
  190.  
  191.     if (gotten == 2)
  192.     {
  193.         return;
  194.     }
  195.  
  196.     if ((GetSenderRef() == commiespot2) && (gotten == 1))
  197.     {
  198.         gotten = 2;
  199.         # Don't do a real cutscene...
  200.         PlayVoice(player, nocommie, 1.0, 1);
  201.         return;
  202.     }
  203.  
  204.     if ((GetSenderRef() == commiespot) || (GetSenderRef() == commiespot2) || (GetSenderRef() == hide_crate))
  205.     {
  206.         if (gotten >= 1)
  207.         {
  208.             return;
  209.         }
  210.  
  211.         # print("in hold");
  212.  
  213.         # Get ready to capture Indy...
  214.         setPulse(0.5);
  215.     }
  216.  
  217.     return;
  218.  
  219. # ..............................................................................
  220.  
  221. exited:
  222.  
  223.     if (gotten >= 1)
  224.     {
  225.         return;
  226.     }
  227.  
  228.     if ((GetSenderRef() == commiespot) || (GetSenderRef() == commiespot2) || (GetSenderRef() == hide_crate))
  229.     {
  230.         # print("left hold");
  231.         setpulse(0.0);
  232.     }
  233.  
  234.     return;
  235.  
  236. # ..............................................................................
  237.  
  238. pulse:
  239.  
  240.     if (IsInvisible() == 1) # 1=indy invisible, 0=visible
  241.     {
  242.         # print("cant see me");
  243.         return;
  244.     }
  245.  
  246.     if (caught == 1)
  247.     {
  248.         return;
  249.     }
  250.  
  251.     # Capture Indy...
  252.     caught = 1;
  253.     setpulse(0.0);
  254.     StartCutscene(1);
  255.     SetActorFlags(player, 0x200000); # no control
  256.     StopThing(player);
  257.     AISetLookThing(commie, player);
  258.     PlayVoice(commie, guardsnd1, 1.0, 1);
  259.     DeselectWeaponWait(player);
  260.  
  261.     # Make an Indy actor...
  262.     caughtindy = CreateThing(indy_tpl, player);
  263.     CaptureThing(caughtindy);
  264.     ClearThingFlags(caughtindy, 0x80000);
  265.     CopyPlayerHolsters(player, caughtindy);
  266.     in_colltype = GetCollideType(caughtindy);
  267.     SetCollideType(caughtindy, 0); # guard no touch actor
  268.     SetThingFlags(player, 0x10); # invisible but touchable!
  269.     in_keyTrack1 = PlayKey(caughtindy, in_raisehands, 4, 0x14, 0);        
  270.  
  271.     AISetLookThing(commie, caughtindy);
  272.     AISetLookThing(caughtindy, commie);
  273.     AISetMoveThing(commie, player, 0);
  274. #    print("commie on the move");
  275.     return;
  276.  
  277.  
  278. # ..............................................................................
  279.  
  280. blocked:
  281.     print("blocked message");
  282.     if ((getsenderref() == commie) && (GetSourceref() != player))
  283.     {
  284. #    print("commie blocked");
  285.     StopThing(commie);
  286.     goto fade_out;
  287.     }
  288.     return;
  289.  
  290. # ..............................................................................
  291.  
  292. touched:
  293.     # Blocked problem fix.
  294. #    if ((GetSenderRef() == commie)  && (GetSourceRef() != player))
  295. #    {
  296. #    print("commie touched something");
  297. #    StopThing(commie);
  298. #    goto fade_out;
  299. #    return;
  300. #    }
  301.     if ((GetSenderRef() == commie)  && (GetSourceRef() == player))
  302.     {
  303. #    print("commie touched by player");
  304.  
  305.         if(caught == 1) 
  306.         {
  307. #            print("touched by player");
  308.             StopThing(commie);
  309.             Sleep(0.5);
  310.             PlayKey(commie, acthit, 4, 0x12, 0);
  311.             Sleep(0.5);
  312.             Stopkey(caughtindy, in_keyTrack1, 0.0);
  313.             in_keyTrack1 = PlayKey(caughtindy, in_fall, 4, 0x14, 0);
  314.             PlaySoundLocal(bop_indy, 1.0, 0, 0x0, 0);
  315.  
  316.             # Thats All Folks.
  317.             goto fade_out;
  318.             return;
  319.         }
  320.         if (tutched == 1) return;
  321.         tutched=1;
  322.         PlayVoice(commie, guardsnd2, 1.0, 1);
  323.         tutched=0;
  324.     }
  325.     return;
  326.  
  327. # ..............................................................................
  328.  
  329. user0:
  330.  
  331.     # Uh-oh, Indy got caught once somewhere else...
  332.     notagain = 1;
  333.     return;
  334.  
  335. # ------------------------------------------------------------------------------
  336. #        SubRoutines
  337. # ------------------------------------------------------------------------------
  338. fade_out:
  339.     # Record some damage (yes, player can die this way)...
  340.     curhealth = GetThingHealth(player);
  341.     SetThingHealth(player, (curhealth - 40));
  342.     Sleep(1.0);
  343.  
  344.     #-------- add fadeout here ------------------------        
  345.     ClearThingFlags(fadething, 0x80000);
  346.     SetThingAlpha(fadething, 0.0); # transparent
  347.     SetCameraFadeThing(2, fadething, fadeGhost, 0);
  348.     SetCurrentCamera(2);
  349.     ThingFadeAnim(fadething, 0.0, 1.0, 1.0, 0);
  350.     ThingFadeAnim(commie, 1.0, 0.0, 1.0, 0);
  351.     ThingFadeAnim(caughtindy, 1.0, 0.0, 1.0, 0);
  352.     Sleep(1.0);
  353.     StopKey(caughtindy, in_keyTrack1, 0.0);
  354.     SetThingAlpha(caughtindy, 1.0); # affects the model
  355.     DestroyThing(caughtindy);
  356.     ClearThingFlags(player, 0x10); # visible when next we see him
  357.     
  358.     if(notagain == 1) # if caught before, kill player
  359.     {
  360.         PlayVoice(commie, guardsnd3, 1.0, 1);
  361.         PlaySoundLocal(killsnd, 1.0, 0.0, 0x0, 0);
  362.         EndCutscene();
  363.  
  364.     #    Print("He's Dead");
  365.         SetThingMass(Player, 0.0);
  366.         ClearActorFlags(player, 0x8);
  367.         DamageThing(player, 1000.0, 0x200, victim);
  368.         return;
  369.     }
  370.  
  371.     notagain = 1;
  372.     SendMessage(brigcog, user0); # put Indy back in his cell
  373.     SendMessage(pumpcog, user0); # inform leverpump cog Indy's been caught once
  374.     SendMessageEx(hintcog, user1, 2, 0, 0, 0); # param0=2; back in cell
  375.     DestroyThing(commie);
  376.     commie = CreateThing(sailor_tpl, enemypos);
  377.     CaptureThing(commie);
  378.     SetThingMass(commie, 0);
  379.     SetActorFlags(commie, 0x8); # Invul.
  380.     AISetCutsceneMode(commie);
  381.     SetThingAlpha(commie, 1.0);
  382.     caught = 0;
  383.     return;
  384.  
  385.  
  386. end
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.